<?php
    //用户收货地址列表
    require_once "config.php";
    require_once "weixin_info.php";
    //商家查看导购员分享链接点击情况
    $sql = $mysql->query("select guide_id from dyspw_shop_guide where shop_id = {$_SESSION['Member_info'][0]['id']} ORDER BY guide_money ASC");
    $gui_list = $sql->fetch_all(MYSQLI_ASSOC);
    $guide_id=array_column($gui_list,'guide_id');
    array_push($guide_id,$_SESSION['Member_info'][0]['id']);
    $uid=implode(',',$guide_id);
    $sql = $mysql->query("select a.*,count(a.code) as click,b.username from sys_share as a left join dyspw_member as b on a.uid = b.id where uid in ($uid) group by a.code order by click desc limit 10");
    $result = $sql->fetch_all(MYSQLI_ASSOC);
 ?>
 <!DOCTYPE html>
 <html lang="en">
 <head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <title>分享链接点击排名</title>
    <script src="js/mui.min.js"></script>
    <link href="css/mui.min.css" rel="stylesheet" />
    <link href="css/index.css" rel="stylesheet" />
    <link rel="stylesheet" href="css/core.css">
 </head>
 <body>
 <style>
     .index{float: left;display: block;width: 20px;height: 20px;background: #ff6b6f;color: #fff;border-radius: 50%;text-align: center}
     .address-item-left{float: left;margin-left: 15px}
 </style>
    <section class="address-list-box">
        <header id="header" class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">分享链接点击排名</h1>
		</header>
        <ul class="mui-table-view">
            <?php if(!empty($result)){ ?>
                <?php foreach ($result as $key => $val) { ?>
                    <li class="mui-table-view-cell address-list-item">
                        <p class="index"><?php echo $key+1 ?></p>
                        <div class="address-item-left">
                            <p class="address-item-left-primary"><?php echo $val['username'] ?> 分享的：(<?php echo $val['title'] ?>)</p>
                            <p class="address-item-left-vice">点击量：<?php echo $val['click'] ?> <a style="float: right;
                            color: #ff6b6f" href="<?php echo $val['url']?>">点击访问</a>  </p>
                        </div>
                    </li>
                <?php } ?>
            <?php } ?>
        </ul>
    </section>
 </body>
 </html>
